package com.ele.web;

import com.ele.pojo.OrderVO;
import com.ele.pojo.Orders;
import com.ele.pojo.ResponseData;
import com.ele.service.OrdersService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 屈博
 * @email qubome@aliyun.com
 * @Date 2024/4/12 14:29
 */
@RestController
@Tag(name = "订单", description = "外卖系统的app接口文档")
public class OrderController {
    @Resource
    private OrdersService ordersService;

    /**
     * 添加订单
     * @param orderVO
     * @return
     */
    @PostMapping("/addOrder")
    public ResponseData<Orders> addOrder(@RequestBody OrderVO orderVO){
        return this.ordersService.addOrder(orderVO);
    }
    /**
     * 查询全部订单
     */
    @GetMapping("/getOrderList")
    public ResponseData<Orders> getOrderList(String userId){
        return this.ordersService.getOrderList(userId);
    }

}
